<template>
  <a-form-model-item :prop="name" :label="label" class="form-item">
    <a-radio-group @change="radioChange" v-model="sValue" name="radioGroup" class="ant-radio-group" :default-value="defaultValue">
      <a-radio :value="item.value" v-for="(item, idx) in options" :key="idx">
        {{ item.label }}
      </a-radio>
    </a-radio-group>
  </a-form-model-item>
</template>

<script>
export default {
  props: {
    iType: {
      type: [String],
      default: 'normal'
    },
    defaultValue: {
      type: [String]
    },
    label: {
      type: [String],
      default: '提示'
    },
    options: {
      type: Array,
      default: () => {
        return []
      }
    },
    //expand
    form: {
      type: [Object]
    },
    name: {
      type: [String]
    },

    refreshKey: {
      type: [String],
      require: true
    }
  },
  data() {
    return {
      isShowTips: false,
      sValue: ''
    }
  },
  watch: {
    refreshKey(n, o) {
      this.sValue = this.form[this.name]
    }
  },
  methods: {
    radioChange($el) {
      let val = $el.target.value
      val && this.$emit('change')
      if (this.form && this.name) {
        this.form[this.name] = val
      }
    }
  }
}

/*

    optionItem: [
      {
        label: '至造云预存款（￥9405.00）',
        value: 1
      },
      {
        label: '至里预存款（￥324523.00）',
        value: 2
      }
    ]

*/
</script>

<style lang="scss" scoped>
.raido-item {
  display: flex;
  align-items: center;
}
.ant-radio-group {
  display: flex;
  margin-left: 20px;
  padding-top: 10px;
}
</style>
